/**
 * 在鼠标离开目标容器时清理boxLine
 */
interface State {
  aimDom: {
    style?: { [organName: string]: string };
    context?: { value: string; type: string };
    faPosition?: { top: number; left: number };
    [organName: string]: any;
  }; //目标DOM节点
  aimPath: {}[]; //目标路径
  aimAttrs: {
    context?: string;
    goto?: { type: string; value: string };
    [organName: string]: any;
  }; //目标属性
  aimBox: { attrs?: { class: string } }; //目标容器
  aimXY: {}; //鼠标与组件的偏移
  componentList: { [organName: string]: {} };
  seniorBoxList: {};
  //为了可以显示margin...
  colorDomStyle: {
    width: string;
    height: string;
    top: string;
    left: string;
    padding: string;
    border: string;
    margin: string;
  };
  judgeColorDom: boolean;
  domStack: {
    type: string;
    pageName: string;
    data: (string | number | {})[];
    path: {}[][];
  }[]; //存储栈
  domStackNum: number; //存储栈控制下标
  page?: {
    tree: {
      [organName: string]: [];
    };
  };
}

export default function store_dragleave(
  state: State,
  { e }: { e: { path: { className: string }[]; preventDefault: Function } }
) {
  // 鼠标移出了页面范围
  if (!state.aimBox) return;

  // 判断目标容器是不是规范的
  // if (
  //   !["fixedBox", "freeBox", "colBoxItem", "seniorBoxItem"].includes(
  //     e.target.getAttribute("data-type")
  //   )
  // )
  //   return;

  // 这样子再拖拽组件的时候，目标容器也有蓝色框框
  if (state.aimBox.attrs && e.path[0].className == state.aimBox.attrs.class) {
    state.aimBox.attrs.class = state.aimBox.attrs.class.replace(" boxLine", "");
  }

  e.preventDefault();
}
